#include "tower.h"
#include "bullet.h"
#include "turn.h"
#include "prop.h"
#include "monster.h"
#include "cspritefactory.h"
#include "CommonClass.h"
CSpriteFactory::CSpriteFactory()
{
    init();
};
CSpriteFactory::~CSpriteFactory() {};
Monster* CSpriteFactory::Produce_Monster(int type)
{
    const char* MonsterName = CSystem::MakeSpriteName("monster_",m_iMonsterSum++);
    const char* cloneName = CSystem::MakeSpriteName("monster_type_",type);
    Monster *monster = new Monster(MonsterName,cloneName);
    return monster;
};
Turn* CSpriteFactory::Produce_Turn(float x,float y,int dec,int type)
{
    const char *name = CSystem::MakeSpriteName("turn",m_iTurnSum++);
    Turn *turn = new Turn(x,y,dec,name,CSystem::MakeSpriteName("turn",type));
    return turn;
}
tower* CSpriteFactory::Produce_Tower(int type)
{
    const char* clonename = CSystem::MakeSpriteName("tower_type_",type);
    const char* name = CSystem::MakeSpriteName("tower_",m_iTowerSum++);
    tower* t = new tower(name,clonename);
    if(type==0)
        t->SetfireSpeed(0.5f);
    if(type==1)
        t->SetfireSpeed(0.8f);
    return t;
};
bullet* CSpriteFactory::Produce_Bullet(int type)
{
    char * name = CSystem::MakeSpriteName("bullet",m_iBulletSum++);
    char *cloneName = CSystem::MakeSpriteName("bullet_type_",type);
    bullet* b =new bullet(name,cloneName);
    return b;
};
prop* CSpriteFactory::Produce_property(int type)
{

    char *name = CSystem::MakeSpriteName("prop_",m_iPropSum++);
    char *cloneName = CSystem::MakeSpriteName("prop",type);
    prop* p = new prop(name,cloneName);
    return p;
};
void CSpriteFactory::init()
{
    m_iMonsterSum = 0;
    m_iTowerSum = 0;
    m_iBulletSum = 0;
    m_iTurnSum = 0;
    m_iPropSum = 0;
};
